import Vue from 'vue'
import http from './http'

class InvokeRequest {
  interfaceId
  data
}

const inbound = {
  invoke (option = InvokeRequest) {
    let data = option.data || {}
    $.extend(data, {
      openid: localStorage.getItem('openid'),
      userId: localStorage.getItem('userId')
    })

    return http.post('/Inbound/invoke.do', {
      rmstoken: '127.0.0.1',
      interfaceId: option.interfaceId,
      data: JSON.stringify(option.data)
    })
  },
}

export default {
  ...{
    install: function () {
      Vue.prototype.$inbound = inbound
    }
  }, ...inbound
}
